<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../vue.2.5.1.js"></script>
</head>

<body>
    <div id='app'>
        <h1>模板内表达式常用于简单的运算，当其过长或者逻辑复杂，会难以维护</h1>
        <div v-pre>
            {{text.split(',').reverse().join(',')}}
        </div>
        <div>
            {{reverseText}}
        </div>
    </div>

    <script>
        var app = new Vue({
            el: '#app',
            data: {
                text: 'find,sky,name'
            },
            computed: {
                reverseText: function() {
                    return this.text.split(',').reverse().join(',')
                }
            }
        })
    </script>
</body>

</html>